<template>
  <el-dialog title="聊天记录" :visible.sync="visible" :close-on-click-modal="false">
    <el-table :data="dataList">
      <el-table-column property="sendName" label="发送人" width="150"></el-table-column>
      <el-table-column
        property="messContent"
        label="消息内容"
        width="200"
      ></el-table-column>
      <el-table-column property="receiveName" label="接收人"></el-table-column>
      <el-table-column property="sendTime" label="发送时间"></el-table-column>
    </el-table>
  </el-dialog>
</template>

<script>
export default {
  data() {
    return {
      visible: false,
      dataList: []
    };
  },
  methods: {
    init(id) {
      this.visible = true;
      this.$http({
        url: this.$http.adornUrl(`/generator/message/messList/${id}`),
        method: "get",
        data: this.$http.adornParams(),
      }).then(({ data }) => {
        if (data && data.code === 0) {
          this.dataList = data.list;
        } else {
          this.$message.error(data.msg);
        }
      });
    }
  },
};
</script>
